<?php
include( "inc/header.php" );
login_check( );
echo "\r\n\r\n<body>\r\n";
switch ( $_GET['Action'] )
{
case "del" :
				@$logtime = date( "Y-m-" ).( date( "d" ) - 7 );
				$db->query( "DELETE FROM tun2_log WHERE logtime<'".$logtime."'" );
				addlog( "删除日志", $_SESSION['user_name'] );
				admin_showerr( "<li>日志错删除成功</li>", "Admin_Log.php", 1 );
				break;
default :
				$execc = "select count(*) from tun2_log";
				$resultc = mysql_query( $execc );
				$rsc = mysql_fetch_array( $resultc );
				@$intNum = $rsc[0];
				@$intPerpage = 20;
				if ( $_GET['PB_page'] )
				{
								$offset = ( $_GET['PB_page'] - 1 ) * $intPerpage;
				}
				else
				{
								$offset = 0;
				}
				$db->query( "SELECT * FROM tun2_log order by id desc limit ".$offset.",{$intPerpage} " );
				echo "<table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\" class=\"table\">\r\n  <tr align=\"center\">\r\n   <td width=\"5%\"><strong>ID</strong></td>\r\n   <td><strong>操作内容</strong></td>\r\n   <td width=\"18%\"><strong>操作时间</strong></td>\r\n   <td width=\"15%\"><strong>管理员</strong></td>\r\n   <td width=\"20%\"><strong>管理IP</strong></td>\r\n  </tr>\r\n";
				while ( $db->next_record( ) )
				{
								echo "  <tr>\r\n    <td align=\"center\">";
								echo $db->Record['id'];
								echo "</td>\r\n    <td>";
								echo $db->Record['logcontent'];
								echo "</td>\r\n    <td align=\"center\">";
								echo $db->Record['logtime'];
								echo "</td>\r\n    <td align=\"center\">";
								echo $db->Record['logoname'];
								echo "</td>\r\n    <td align=\"center\">";
								echo $db->Record['logip'];
								echo "</td>\r\n  </tr>\r\n";
				}
				echo "<form action=\"Admin_Log.php?Action=del\" method=\"post\">\r\n  <tr>\r\n    <td colspan=\"5\" align=\"right\">\r\n      <input type=\"submit\" name=\"Submit_del\" value=\"删除全部日志[系统自动保留前7天日志]\"></td>\r\n  </tr>\r\n </form>\r\n</table>\r\n";
				require_once( "../inc/class.page.php" );
				class mypage extends page
				{

								public function show( )
								{
												$_obfuscate_PetQzc0Ypg = "<div class=\"pagenavi\" id=\"lopage\">";
												$_obfuscate_PetQzc0Ypg .= $this->first_page( )." ";
												$_obfuscate_PetQzc0Ypg .= $this->nowbar( "", "curr" );
												$_obfuscate_PetQzc0Ypg .= "<span class=\"break\">...</span>";
												$_obfuscate_PetQzc0Ypg .= $this->last_page( );
												$_obfuscate_PetQzc0Ypg .= "   (总计<span class=\"num\">".$this->totalpage."</span>页) </div>";
												$_obfuscate_PetQzc0Ypg .= "</div>";
												return $_obfuscate_PetQzc0Ypg;
								}

				}

				@$page = @new mypage( array(
								"total" => $intNum,
								"perpage" => $intPerpage
				) );
				echo $page->show( );
}
echo "</body>\r\n</html>\r\n";
?>
